'''
生成一个字符串的所有可能排列（不考虑重复字符）
'''
def permute(s):
    # 基线条件：空字符串或单字符字符串
    if len(s) <= 1:
        return [s]

    result = []
    for i in range(len(s)):
        # 当前字符作为首字符
        current_char = s[i]
        # 剩余字符组成的子串
        remaining_chars = s[:i] + s[i + 1:]

        # 递归生成剩余字符的所有排列
        for perm in permute(remaining_chars):
            result.append(current_char + perm)

    return result


# 测试
print(permute("abc"))
# 输出: ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
